
class OuterClass2{
    public int data1 = 1;
    private int data2 = 2;
    public static int data3 = 3;

    //静态内部类
    static class InnerClass2{
        public int data1 = 10000;
        public int data4 = 4;
        private int data5 = 5;
        public static final int data6 = 6;//常量

//        public OuterClass2 out = new OuterClass2();第一种方案
          public OuterClass2 out;//第二种方案
        public InnerClass2(){

        }
        public InnerClass2(OuterClass2 out){
            this.out = out;
        }


        public void test(){
            OuterClass2 outerClass2 = new OuterClass2();
            System.out.println(data1);
            System.out.println(out.data2);
            System.out.println(data3);
            System.out.println(data4);
            System.out.println(data5);
            System.out.println(data6);
            System.out.println("InnerClass2::test()");
        }

    }
}
public class TestDemo3 {
    public static void main(String[] args) {
        OuterClass2 out = new OuterClass2();
        OuterClass2.InnerClass2 innerClass2 = new OuterClass2.InnerClass2(out);
    }

    public static void main1(String[] args) {
        OuterClass2.InnerClass2 innerClass2 = new OuterClass2.InnerClass2();
    }
}
